<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>12_entends_prototype01</title>
	<meta name="author" content="Stark" />
	<!-- Date: 2018-10-20 -->
	<script type="text/javascript">
		function Parent() {
			this.color = ["red","blue"];
			this.name = "Leno";
		}
		
		function Child() {
			// 在Child中的this明显是指向Child的对象
			// 当调用Parent方法时，而且this又指向Child
			// 此时就等于在这里完成了this.color = ["red","blue"];
			// 也就等于在Child中有了this.color属性，这样也就变相的完成了继承
			Parent.call(this);
			
			// Parent()这种方式仅仅完成了函数的调用，根本无法实现继承
		}
		
		var c1 = new Child();
		c1.color.push("green");
		alert(c1.color);
		var c2 = new Child();
		alert(c2.color);
		alert(c2.name);
	</script>
</head>
<body>

</body>
</html>

